package chapter5_stack_and_linked;

import java.util.Collection;
import java.util.HashMap;

/**
 * @author yuh
 * @date 2018/4/10 19:35
 * @description
 */
public class Zuhe {
    public static void main(String[] args) {
        String str = "abc-123-opq";
       /* String[] split = str.split("-");
        int b = split.length - 1;
        HashMap<Integer, String> map = new HashMap<>();
        for (int i = 0; i < split.length; i++) {
            String s = map.get(i - 1);
            if (s == null) {
                map.put(i, split[i]);
            } else {
                map.put(i, s + "-" + split[i]);
            }
        }
        Collection<String> values = map.values();
        System.out.println(values);*/

       str = str+"-";
        for (int i = 0; i < str.length(); i++) {
            if(str.charAt(i) == '-'){
                System.out.println(str.substring(0,i));
            }
        }

    }
}
